#include "Button.h"

Button::Button(int x, int y, LPCTSTR name, int num)
{
	this->x = x;
	this->y = y;
	this->num = num;
	this->loadImageWith(name);
}

Button::~Button()
{
}

void Button::getMoveX(int move_x)
{
	this->move_x = move_x;
}

void Button::update(CDC* mdc)
{
	drawButton(mdc);
}

void Button::drawButton(CDC* mdc)
{
	if (this->num != 6 && this->num != 7) {
		if (this->num == 1)
		{
			switch (age)
			{
			case 0:
				this->loadImageWith("1.1.png");
				break;
			case 1:
				this->loadImageWith("2.1.png");
				break;
			case 2:
				this->loadImageWith("3.1.png");
				break;
			default:
				break;
			}
		}
		if (this->num == 2)
		{
			switch (age)
			{
			case 0:
				this->loadImageWith("1.2.png");
				break;
			case 1:
				this->loadImageWith("2.2.png");
				break;
			case 2:
				this->loadImageWith("3.2.png");
				break;
			default:
				break;
			}

		}
		image.AlphaBlend(mdc->m_hDC, this->x + this->move_x, this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
	}
	else if (this->num == 6) {
		image.AlphaBlend(mdc->m_hDC, this->x + this->move_x, this->y, image.GetWidth() * percent, image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
	}
	else if (this->num == 7) {
		if (this->count > 0)
			image.AlphaBlend(mdc->m_hDC, this->x + this->move_x, this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
		if (this->count > 1)
			image.AlphaBlend(mdc->m_hDC, this->x + this->move_x + image.GetWidth(), this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
		if (this->count > 2)
			image.AlphaBlend(mdc->m_hDC, this->x + this->move_x + image.GetWidth() * 2, this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
		if (this->count > 3)
			image.AlphaBlend(mdc->m_hDC, this->x + this->move_x + image.GetWidth() * 3, this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
		if (this->count > 4)
			image.AlphaBlend(mdc->m_hDC, this->x + this->move_x + image.GetWidth() * 4, this->y, image.GetWidth(), image.GetHeight(), 0, 0, image.GetWidth(), image.GetHeight());
	}
}
